{include file="./layout/header.html" /}
<body>
<div class="x-body" >
    <form class="layui-form" id="intr">

        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input   type="hidden" id="sid" name="sid" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="" value='{$sid}'>
            </div>
        </div>

        <div class="layui-form-item">
            <label for="relationship" class="layui-form-label">
                <span class="x-red">*</span>关系
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="relationship" name="relationship" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div><span style="line-height: 37px">如自己，同事、好友、秘书</span>
        </div>

        <div class="layui-form-item">
            <label for="full_name" class="layui-form-label">
                <span class="x-red">*</span>全名
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="full_name" name="full_name" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div><span style="line-height: 37px">如张三</span>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                {foreach $data.gender as $key => $v}
                <input type="radio" name="gender" value="{$key}" title="{$v}" checked>
                {/foreach}
            </div>
        </div>

        <div class="layui-form-item">
            <label for="birthday" class="layui-form-label">
                <span class="x-red">*</span>出生日期
            </label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input"  name="birthday" id="birthday">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="nationality" class="layui-form-label">
                <span class="x-red">*</span>国籍
            </label>
            <div class="layui-input-inline">
                <select id="nationality" name="nationality" lay-verify="">
                    <option value="">请选择一个国家</option>
                    {foreach $data.countries as $key => $v}
                    <option value="{$v}">{$v}</option>
                    {/foreach}
                </select>

            </div><span style="line-height: 37px">如中华人民共和国</span>
        </div>

        <div class="layui-form-item">
            <label for="passport_number" class="layui-form-label">
                <span class="x-red">*</span>签证编码
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="passport_number" name="passport_number" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div><span style="line-height: 37px">如9633-A978E5-666889-2235456</span>
        </div>

        <div class="layui-form-item">
            <label for="address" class="layui-form-label">
                <span class="x-red">*</span>大学/院校+居住地
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="address" name="address" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div><span style="line-height: 37px">如浙江大学西湖校区…</span>
        </div>

        <div class="layui-form-item">
            <label for="designation_title" class="layui-form-label">
                <span class="x-red">*</span>称呼或头衔
            </label>
            <div class="layui-input-inline">
                <!--<input   type="text" id="designation_title" name="designation_title" required="" lay-verify="required"-->
                         <!--autocomplete="off" class="layui-input" placeholder="">-->
                <select id="designation_title" name="designation_title" lay-verify="">
                    <option value="">请选择一个头衔</option>
                    {foreach $data.title as $key => $v}
                    <option value="{$v}">{$v}</option>
                    {/foreach}
                </select>
            </div><span style="line-height: 37px">如博士</span>
        </div>

        <div class="layui-form-item">
            <label for="issuing_country" class="layui-form-label">
                <span class="x-red">*</span>签证颁发国家
            </label>
            <div class="layui-input-inline">
                <!--<input   type="text" id="issuing_country" name="issuing_country" required="" lay-verify="required"-->
                         <!--autocomplete="off" class="layui-input" placeholder="">-->
                <select id="issuing_country" name="issuing_country" lay-verify="">
                    <option value="">请选择一个国家</option>
                    {foreach $data.countries as $key => $v}
                    <option value="{$v}">{$v}</option>
                    {/foreach}
                </select>

            </div><span style="line-height: 37px">如中华人民共和国</span>
        </div>

        <div class="layui-form-item">
            <label for="duration_arrival" class="layui-form-label">
                <span class="x-red">*</span>签证有效期
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="duration_arrival" name="duration_arrival" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline">
                <input   type="text" id="duration_departure" name="duration_departure" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div>
        </div>

        <div class="layui-form-item">
            <label for="passport_front_url" class="layui-form-label">
                <span class="x-red">*</span>护照正面图片地址
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="passport_front_url" name="passport_front_url" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div><span style="line-height: 37px">如/site-qx/passport/afdasdeead_front.png</span>
        </div>

        <div class="layui-form-item">
            <label for="passport_back_url" class="layui-form-label">
                <span class="x-red">*</span>护照反面图片地址
            </label>
            <div class="layui-input-inline">
                <input   type="text" id="passport_back_url" name="passport_back_url" required="" lay-verify="required"
                         autocomplete="off" class="layui-input" placeholder="">
            </div><span style="line-height: 37px">如/site-qx/passport/afdasdeead_front.png</span>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                增加
            </button>
        </div>
    </form>
</div>

<!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain">
        这里写你的初始化内容
    </script>
<!-- 引入百度编辑器 -->
<script type="text/javascript" src="__CDN__/lib/ueditor/ueditor.config.js" charset="utf-8"></script>
<script type="text/javascript" src="__CDN__/lib/ueditor/ueditor.all.js" charset="utf-8"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('desc');
    var ue = UE.getEditor("['zh-CN']['content']");
    var ue = UE.getEditor("['en']['content']");
</script>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data){
            // var str = new Array(); //定义一数组
            // str = uri$('#intr').serialize();
            var formData = $("#intr").serialize();

            //发异步，把数据提交给php
            $.ajax({
                dataType : 'json',
                type : 'POST',
                url : '{:url("Confervisa/add")}',
                async: false,
                data : formData,
                success : function(msg){
                    layer.alert(msg.msg, {icon: 6},function () {
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.status + "," + textStatus);
                }
            });

            return false;
        });


    });

    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#birthday' //指定元素
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#duration_arrival' //指定元素
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#duration_departure' //指定元素
        });
    });

</script>
{include file="./layout/footer.html" /}